/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package meta

import (
	"github.com/rs/zerolog/log"
	"github.com/spf13/cobra"
	"satellite/app/meta"
)

// versionCmd represents the versionCmd command
var versionCmd = &cobra.Command{
	Use:     "version",
	Aliases: []string{"/v"},
	Short:   "设置meta资源的版本",
	Args:    Args,
	Run: func(cmd *cobra.Command, args []string) {
		s := meta.NewVersion(versionOption).WithBase(base)
		err := s.Run()
		if err != nil {
			log.Warn().Err(err).Send()
		}
	},
}
var (
	versionOption = new(meta.VersionOption)
)

func init() {
	metaCmd.AddCommand(versionCmd)
	versionCmd.Flags().BoolVarP(&versionOption.Add, "add", "a", false, "增加版本")
	versionCmd.Flags().IntVarP(&versionOption.Set, "set", "s", 0, "设置版本")
}
